{extend name="../../admin/view/main"}

{block name="button"}
{if auth("batch_pass")}
<!--<button  data-action='{:url("batch_pass")}' data-rule="id#{key}"  class='layui-btn layui-btn-sm'>批量通过</button>-->
{/if}
{/block}

{block name="content"}
<div class="layui-tab layui-tab-card think-bg-white">
    <div class="layui-tab-content">
        {include file='control/claim_review/index_search'}
        <table class="layui-table margin-top-10" lay-skin="line">
            {notempty name='list'}
            <thead>
            <tr>
                <th class='list-table-check-td think-checkbox'>
                    <label><input data-auto-none data-check-target='.list-check-box' type='checkbox'></label>
                </th>
                <th class='text-left nowrap'>领用编号</th>
                <th class='text-left nowrap'>领用标题</th>
                <th class='text-left nowrap'>领用所属人</th>
                <th class='text-left nowrap'>领用状态</th>
                <th class='text-left nowrap'>提交时间</th>
                <th class='list-table-sort-td'></th>
                <th class='text-left nowrap'></th>
            </tr>
            </thead>
            {/notempty}
            <tbody>
            {foreach $list as $key=>$vo}
            <tr>
                <td class='list-table-check-td think-checkbox'>
                    <label><input class="list-check-box" type='checkbox' value='{$vo.id}'></label>
                </td>
                <td class='nowrap'>
                    <div class="inline-block text-top sub-span-blue">
                        <div>编号：<span>{$vo.id|default='--'}</span></div>
                    </div>
                </td>
                <td class='nowrap'>
                    <div class="inline-block text-top sub-span-blue">
                        <div>标题：<span>{$vo.plan_title|default='--'}</span></div>
                    </div>
                </td>
                <td class='nowrap'>
                    <div class="inline-block text-top sub-span-blue">
                        <div>领用人：<span>{$vo.admin_name|default='--'}</span></div>
                    </div>
                </td>
                {if $authorize}
                {if $vo.plan_status > $authorize and $vo.status eq 1}
                <td class='text-center nowrap'>
                    <span class="layui-badge layui-bg-green">已通过</span><br>
                </td>
                {else/}
                <td class='text-center nowrap'>
                    {eq name='vo.status' value='0'}<span class="layui-badge" style="background: #FFB800;color: #fff">待审核</span>{/eq}{eq name='vo.status' value='1'}<span class="layui-badge layui-bg-green">已通过</span>{/eq}{eq name='vo.status' value='-1'}<span class="layui-badge">已拒绝</span>{/eq}<br>
                </td>
                {/if}
                {else/}
                <td class='text-center nowrap'>
                    {eq name='vo.status' value='0'}<span class="layui-badge" style="background: #FFB800;color: #fff">待审核</span>{/eq}{eq name='vo.status' value='1'}<span class="layui-badge layui-bg-green">已通过</span>{/eq}{eq name='vo.status' value='-1'}<span class="layui-badge">已拒绝</span>{/eq}<br>
                </td>
                {/if}
                <td class='nowrap'>
                    <div class="inline-block text-top sub-span-blue">
                        <div>时间：<span>{$vo.create_at|default='--'}</span></div>
                    </div>
                </td>
                <td class='nowrap'>

                </td>
                <td class='nowrap sub-strong-blue'>
                    
                    {if $vo.plan_status != $authorize or $vo.status eq '-1' or $vo.status eq 1}
                    <!--{if auth("ca_detail")}-->
                    <a class="layui-btn layui-btn-xs" data-modal='{:url("ca_detail")}?id={$vo.id}'>查看流程</a>
                    <!--{else}-->
                    <a class="layui-btn layui-btn-xs layui-btn-primary layui-disabled" data-tips-text="您没有查看流程的权限哦！">查看流程</a>
                    <!--{/if}-->
                    <!--{if auth("detail")}-->
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-modal="{:url('detail')}?id={$vo.id}">详 情</a>
                    <!--{else}-->
                    <a class="layui-btn layui-btn-xs layui-btn-primary layui-disabled" data-tips-text="您没有详情的权限哦！">详 情</a>
                    <!--{/if}-->
                    {else/}
                    <!--{if auth("ca_detail")}-->
                    <a class="layui-btn layui-btn-xs" data-modal='{:url("ca_detail")}?id={$vo.id}'>查看流程</a>
                    <!--{else}-->
                    <a class="layui-btn layui-btn-xs layui-btn-primary layui-disabled" data-tips-text="您没有查看流程的权限哦！">查看流程</a>
                    <!--{/if}-->
                    <!--{if auth("detail")}-->
                    <a class="layui-btn layui-btn-xs layui-btn-warm" data-confirm="确认审核所选记录？" data-action="{:url('resume')}" data-value="id#{$vo.id};plan_status#{$vo.plan_status}" data-csrf="{:systoken('resume')}">通 过</a>
                    <!--{/if}-->
                    <!--{if auth("refusal")}-->
                    <a class="layui-btn layui-btn-xs layui-btn-danger" onclick="refusalCause('{$vo.id}');">拒 绝</a>
                    <!--{/if}-->

                    <!--{if auth("detail")}-->
                    <a class="layui-btn layui-btn-xs layui-btn-normal" data-modal="{:url('detail')}?id={$vo.id}">详 情</a>
                    <!--{else}-->
                    <a class="layui-btn layui-btn-xs layui-btn-primary layui-disabled" data-tips-text="您没有详情的权限哦！">详 情</a>
                    <!--{/if}-->
                    {/if}

                </td>
            </tr>
            {/foreach}
            </tbody>
        </table>
        {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
    </div>
    <script>
        form.render()
        function refusalCause(ids) {
            var remarkReason = "";
            layer.prompt({
                formType: 0,
                value: '',
                title: '请输入拒绝原因',
                btn: ['确定','取消'], //按钮，
                btnAlign: 'c'
            }, function(value,index){
                remarkReason = value;
                layer.close(index);
                $.ajax({
                    type: 'POST',
                    url: "{:url('refusal')}",
                    data: {
                        id: ids,
                        refusal_cause: remarkReason
                    },
                    dataType: "json",
                    success: function (data) {
                        console.log(data)
                        if(data.code==1){
                            layer.msg(data.info, {icon: 1},function () {
                                console.log(index)
                                parent.location.reload();
                            });
                        }
                    }
                });
            },function (value,index) {

            });
        }
    </script>
</div>
{/block}